﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace EzyGoEzySystem.Models
{
    /// <summary>
    /// consist of personal information about a commuter
    /// </summary>
    /// <author>Hoang Nguyen Nhat Tao</author>
    public class Account
    {
        #region Private Fields

        private string _password;
        private bool _isAdmin = false;

        #endregion

        #region Scalar Properties

        [Key]
        public int ID { get; set; }

        [Required]
        public string Name { get; set; }

        //public string NRIC { get; set; }

        [Required]
        public string PhoneNumber { get; set; }

        [Required]
        public string MacAddress { get; set; }

        [Required]
        public string Email { get; set; }

        [Required]
        public bool IsAdmin 
        {
            get { return _isAdmin; }
            set { _isAdmin = value; }
        }

        //public DateTime? DateOfBirth { get; set; }

        //public string Gender { get; set; }

        //public string Address { get; set; }

        [Required]
        public string Username { get; set; }

        [Required]
        public string Password 
        {
            get { return _password; }
            // password needs to be encrypted before saving into database
            set { _password = Services.Encryptor.Encrypt(value); } 
        }

        [Required]
        public double Balance { get; set; }

        [Required]
        public string PaymentMethod { get; set; }

        public string CreditCard { get; set; }

        #endregion

        #region Navigation Properties

        public virtual ICollection<TravelJournalEntry> TravelJournalEntries { get; set; }

        public virtual ICollection<PaymentJournalEntry> PaymentJournalEntries { get; set; }

        #endregion
    }
}